from django.core.urlresolvers import reverse

def has_all_attrs(obj, *attrs):
    """
    >>> has_all_attrs([],'append','__len__')
    True
    >>> has_all_attrs((),'append','__len__')
    False
    """
    for attr in attrs:
        if not hasattr(obj, attr):
            return False 
    return True

def labelize(str):
    """
    >>> labelize("antonio_canova")
    u'Antonio Canova' 
    """
    if str:
        return u" ".join([ a.capitalize() for a in str.split("_") ])  
    return ""

